import request from "../../request";

export default {
  pageList(data) {
    //字典列表--无高级搜索
    return request({
      url: "TsysDict/page",
      method: "post",
      data
    });
  },
  searchList(data) {
    //字典列表--有高级搜索
    return request({
      url: "TsysDict/page",
      method: "post",
      data
    });
  },
  treeList(data) {
    //新增字典 树状图查询
    return request({
      url: "TsysDict/catalog",
      method: "post",
      data
    });
  },
  addDict(data) {
    //新增字典
    return request({
      url: "TsysDict/save",
      method: "post",
      data
    });
  },
  removeDict(data) {
    //删除字典
  },
  updateStatus(data) {
    //修改状态（启用，停用）
    return request({
      url: "TsysDict/updateState",
      method: "post",
      data
    });
  },
  updateDict(data) {
    //修改字典
    return request({
      url: "TsysDict/update",
      method: "post",
      data
    });
  },
  selectCode(data) {
    // //下拉选字典
    // return request({
    //   url: "TsysDict/findByCode",
    //   method: "post",
    //   data
    // });
    return new Promise((resolve, reject) => {
      resolve({ code: "1", data: dict[data.dictCode] });
    });
  }
};

const dict = {
  user_sex: [
    { dictName: "男", dictCode: "1" },
    { dictName: "女", dictCode: "0" }
  ], //用户性别
  log_oper_kind: [
    { dictName: "1", codeKey: "1" },
    { dictName: "2", codeKey: "2" }
  ], //操作类型
  log_status: [
    { dictName: "成功", dictCode: "1" },
    { dictName: "失败", dictCode: "0" }
  ], //日志状态
  menu_kind: [
    { dictName: "目录", dictCode: 0 },
    { dictName: "菜单", dictCode: 1 },
    { dictName: "按钮", dictCode: 2 }
  ], //菜单类别
  dict_type: [
    { dictName: "目录", dictCode: "1" },
    { dictName: "菜单", dictCode: "2" },
    { dictName: "字典", dictCode: "3" }
  ], //字典类别
  organization_type: [
    { dictName: "企业", dictCode: 0 },
    { dictName: "部门", dictCode: 1 }
  ] //机构类型
};
